package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type MarkBitmapSignInLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMarkBitmapSignInLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MarkBitmapSignInLogic {
	return &MarkBitmapSignInLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// ===== 位图相关 =====
func (l *MarkBitmapSignInLogic) MarkBitmapSignIn(in *user.MarkBitmapSignInRequest) (*user.SignInResponse, error) {
	// 调用 dao 层的 MarkBitmapSignIn 方法
	err := dao.MarkBitmapSignIn(in.UserId) // 调用 dao 层的 MarkBitmapSignIn 方法
	if err != nil {
		return &user.SignInResponse{
			Success: false,
			Points:  0,
			Message: "签到失败",
		}, err
	}

	return &user.SignInResponse{
		Success: true,
		Points:  10,
		Message: "签到成功",
	}, nil
}
